<?php
/**
 *
 * Created by PhpStorm.
 * User: Egor <http://gitee.com/seosite>
 * Date: 2018/5/8
 * Time: 下午7:17
 * Updatetime:
 * updater：
 */
namespace Wap\Controller;

class BoController extends BaseController{

    /**
     * @desc add
     * @author Egor<http://gitee.com/seosite>
     * @param $param
     * @return array
     */
    public function add($param)
    {
        $check = CheckFactoryController::isParamSet();
        $check->before($param);

        $check = CheckFactoryController::isChildParamSet();
        $check->before('bo_id');
        unset($check);

        $model = M('uuid_bo');
        $model->where(['uuid'=>$_POST['uuid']])->delete();

        $insert_data = array(
            'uuid'    =>  $_POST['uuid'],
            'bo_id'   =>  $param['bo_id'],
            'create_time'   =>  NOW_TIME,
        );
        $operation = $model->add($insert_data);

        if ($operation) return showErrorMsg(L("_OPERATION_SUCCESS_"));
        return showErrorMsg(L("_OPERATION_FAIL_"),100002);
    }

    /**
     * @desc remove
     * @author Egor<http://gitee.com/seosite>
     * @param $param
     * @return array
     */
    public function remove()
    {
        $model = M('uuid_bo');
        $operation = $model->where(['uuid'=>$_POST['uuid']])->delete();
        if ($operation) return showErrorMsg(L("_OPERATION_SUCCESS_"));
        return showErrorMsg(L("_OPERATION_FAIL_"),100002);
    }

}